#ifndef WSYMATH_H
#define WSYMATH_H

#define _USE_MATH_DEFINES
#include <math.h>
#include <QObject>

#include "QtGui/QOpenGLFunctions"

/** 王诗阳通用的数学模板 */
class WSYMath : public QObject
{
    Q_OBJECT
public:
    WSYMath() {}
    virtual ~WSYMath() {}
    static double DegreeToRadian(double angle) { //角度转弧度
        return M_PI / 180 * angle;
    }
    static double RadianToDegree(double radian) { //弧度转角度
        return radian / M_PI * 180;
    }
    static double remainder (double n1, double n2) {
        if (n2 == 0) return NULL;
        double nn1 = abs(n1), nn2 = abs(n2);
        while(nn1 > nn2) {
            nn1 = nn1 - nn2;
        }
        return nn1 * n1 / abs(n1);
    }
    static void newVertexValue(double x, double y, GLfloat *point) {
        point[0] = x; point[1] = y;
    }
};

#endif // WSYMATH_H
